<%--
  Created by IntelliJ IDEA.
  User: lml
  Date: 2022/10/24
  Time: 19:50
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="a" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>基础信息</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/layui-v2.7.6/layui/css/layui.css" >
</head>
<body>
<form class="layui-form" action=""  id="saveUserForm" lay-filter="updateUserFormFilter">
    <input type="hidden" name="id" >

    <form class="layui-form" enctype="multipart/form-data" action="" >

        <div class="registerbox-title">用户基础信息</div>
        <div class="layui-form-item">
            <div class="layui-form-item pass" >
                <label class="layui-form-label">用户id</label>
                <div class="layui-input-inline">
                    <input type="text" name="id" autocomplete="off" value="${user.id}"
                           class="layui-input" id="id">
                </div>
            </div>
            <label class="layui-form-label">用户账号</label>
            <div class="layui-input-inline">
                <input type="text" name="username" id="username" lay-verify="required" value="${user.username}" placeholder="请输入账号" autocomplete="off"
                       class="layui-input">
            </div>
        </div>



        <div class="layui-form-item">
            <label class="layui-form-label">性别</label>
            <div class="layui-input-block">
                <input type="text" name="sex" value="${user.sex}" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">角色</label>
            <div class="layui-input-block">
               <input type="text" id="role" name="role" class="layui-input">
            </div>
        </div>


        <%--状态--%>
        <div class="layui-form-item">
            <label class="layui-form-label">状态</label>
            <div class="layui-input-block">
                <input type="radio" name="sex" value="启用" title="启用" <c:if test="${user.status=='1'}">checked</c:if> disabled>
                <input type="radio" name="sex" value="禁用" title="禁用" <c:if test="${user.status=='2'}">checked</c:if> disabled>
                </div>
        </div>

        <%--开关   选中的时候 on   未选中的时候 off  一般不用开关传值   on 1  off 2--%>


        <div class="layui-form-item">
            <div class="layui-upload" style="margin-left: 90px">
                <div class="layui-upload-list" style="margin:10px -3px;">

                    <img class="layui-upload-img"
                         width="100px" height="100px" style="border-radius: 50%" id="demo1" src="${user.imgpath}">
                    <p id="demoText"></p>
                </div>
            </div>
        </div>

    </form>
    </form>

<script src="${pageContext.request.contextPath}/static/layui-v2.7.6/layui/layui.js"></script>
<script src="${pageContext.request.contextPath}/static/jquery-3.6.1.min.js"></script>
<script>
   $(function (){
        var params={};
        params.rid=${user.rid}
        $.ajax({
            url:"${pageContext.request.contextPath}/tRole/queryById",
            type:"post",
            dataType:"JSON",
            data:params,//表单里所有数据
            success:function (ret){

                $("#role").val(ret.data)
            }
        })
           var status=${user.status}
               alert(${user.status})
           if (status =="2"){
               alert(${user.status})
               $("#statusswitch").prop("checked", true);

           }
    },
    )
</script>
</body>
</html>
